<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateManagerTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('manager', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 20)->unique()->notNull();//默认为notNull
            $table->string('realname', 20)->nullable();
            $table->string('password')->notNull();
            $table->enum('gender', [1, 2, 3])->nullable()->comment('1-男，2-女，3-保密');
            $table->string('telephone', 20)->nullable();
            $table->string('email', 50)->nullable();
            $table->integer('role_id')->default('2')->nullable();
            $table->enum('status', [1, 2])->default('1')->nullable()->comment('账号状态，1-禁用，2-启用');
            $table->rememberToken()->comment('下次自动登录');
            // $table->timestamps();// created_at 和  updated_at
            $table->timestamp('created_at')->useCurrent()->nullable();
            $table->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'))->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('manager');
    }
}
